//
//  CustomPhone.m
//  SoundPill
//
//  Created by 温冬 on 15/5/12.
//  Copyright (c) 2015年 宋旭东. All rights reserved.
//

#import "CustomPhone.h"

@implementation CustomPhone
- (instancetype)initWithFrame:(CGRect)frame image:(UIImage *)myImage placeHold:(NSString *)placeHold
{
    self = [super initWithFrame:frame];
    if (self) {
        UIView *registerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        registerView.backgroundColor = [UIColor whiteColor];
        registerView.layer.borderWidth = 2;
        registerView.layer.borderColor = [[UIColor blackColor] CGColor];
        [self addSubview:registerView];
        
        self.image = [[UIImageView alloc] initWithFrame:CGRectMake(10, 7.5, 20, 20)];
        self.image.image = myImage;
        [registerView addSubview:self.image];
        
        self.field = [[UITextField alloc] initWithFrame:CGRectMake(35, 7.5, 180, 20)];
        self.field.textColor = [UIColor blackColor];
        self.field.placeholder = placeHold;
        [self.field setValue:[UIColor colorWithRed:200 / 255.0 green:201 / 255.0 blue:202 / 255.0 alpha:1.0]forKeyPath:@"_placeholderLabel.textColor"];
        [registerView addSubview:self.field];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
